﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SampleWebsite.Models;
using System.Collections;
using System.Data;

namespace SampleWebsite.Controllers
{
    public class MoviesController : Controller
    {
        //
        // GET: /Movies/
        private MoviesEntities _db = new MoviesEntities(); 


        public ActionResult List()
        {
            ArrayList paramList = new ArrayList
            {
            };

            var dtGetMovieList = Data.Connections.GetDataTable("GetMovieList", paramList, "ApplicationServices");

            var Movie = new Models.JSON.MovieListArray { };

            foreach (DataRow drGetMovieList in dtGetMovieList.Rows)
            {
                Movie.Movies.Add(new Models.JSON.MovieList
                {
                    Id = drGetMovieList["Id"].ToString(),
                    MovieTitle = drGetMovieList["MovieTitle"].ToString(),
                    ReleaseDate = drGetMovieList["DateRelease"].ToString()
                });
            }
            return View("", Movie);
            //return View(_db.Movies.ToList());
        }

        public ActionResult Create()
        {
            return View("Create");
        }

        public ActionResult Edit()
        {
            return View("Edit");
        }
    }
}
